package com.gcxy.controller;



import com.gcxy.conf.result.R;
import com.gcxy.dto.ddvDTO;
import com.gcxy.entity.DataDicVal;
import com.gcxy.service.DataDicValService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hy
 * @since 2023-08-16
 */
@Api(tags = "数据字典值")
@RestController
@RequestMapping("/data-dic-val")
public class DataDicValController {

    @Autowired
    private DataDicValService dataDicValService ;

    @PostMapping("/addDic")
    @ApiOperation("添加数据字典值接口")
    public R addDic(@Validated(value = {DataDicValService.class}) @RequestBody DataDicVal dataDicVal){
        return dataDicValService.addDic(dataDicVal);
    }

    @ApiOperation("查询数据字典值接口")
    @PostMapping("/queryDicValueList")
    public R queryDicValueList(@RequestBody ddvDTO ddv){

        return dataDicValService.queryDicValueList(ddv);
    }

    @ApiOperation("修改数据字典值接口")
    @PutMapping("/updateDdvState/{ddvId}")
    public R updateDdvState(@PathVariable Integer ddvId){
        return dataDicValService.updateDdvState(ddvId);

    }

}
